package com.example.edu.Mapper;

import com.example.edu.Entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface Course_StudentMapper {
    void addMany(@Param("course_id") int course_id, @Param("ids") List<User> ids);

    @Insert("insert ignore into course_student values (#{course_id},#{id})")
    void add(@Param("course_id") int course_id, @Param("id") int id);

    @Select("select count(*) from course_student where course_id = #{course_id}")
    int getNum(@Param("course_id") int course_id);

    void deleteMany(@Param("course_id") int course_id, @Param("ids") List<User> ids);

    @Delete("delete from course_student where course_id = #{course_id} and user_id = #{id}")
    void delete(@Param("course_id") int course_id, @Param("id") int id);
}
